WPF QR Code Scanner
Use IronQR to scan QR codes in a WPF desktop application. Open an image file with the native OpenFileDialog, load it using AnyBitmap.FromFile, and decode it with QrReader.Read. No JavaScript or browser needed.
5-step guide for scanning a QR code in WPF
- using IronQr;
- using IronSoftware.Drawing;
- var dialog = new OpenFileDialog { Filter = "Image Files|.png;.jpg;.jpeg;.bmp" };
- var inputBmp = AnyBitmap.FromFile(dialog.FileName);
- var results = reader.Read(imageInput);
Code Explanation
OpenFileDialog handles native Windows file selection filtered to common image types. AnyBitmap.FromFile loads the chosen file into a bitmap regardless of format. A QrImageInput wraps that bitmap so IronQR can work with it, and QrReader.Read returns an IEnumerable<QrResult> with one entry for each QR code found in the image. FirstOrDefault grabs the first result safely, so the app does not crash if the image has no QR code.

